home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 1.iso / ARGONET / PD / PROGRAMMING / DESKLIBC / SOURCES.ZIP / DeskLib / !DLSources / Libraries / Msgs / c / Drop next >
Text File  |  1995-07-23  |  2KB  |  64 lines

  1. /*
  2.     ####             #    #     # #
  3.     #   #            #    #       #          The FreeWare C library for 
  4.     #   #  ##   ###  #  # #     # ###             RISC OS machines
  5.     #   # #  # #     # #  #     # #  #   ___________________________________
  6.     #   # ####  ###  ##   #     # #  #                                      
  7.     #   # #        # # #  #     # #  #    Please refer to the accompanying
  8.     ####   ### ####  #  # ##### # ###    documentation for conditions of use
  9.     ________________________________________________________________________
  10.  
  11.     File:    Msgs.Drop.c
  12.     Author:  Copyright © 1992 Jason Williams
  13.     Version: 1.00 (08 Apr 1992)
  14.     Purpose: MessageTrans-like message handling functions.
  15.              (If you want MessageTrans, use the SWI interface, if you want
  16.              high-level message handling, use this code...)
  17. */
  18.  
  19.  
  20. #include <stdlib.h>
  21.  
  22. #include "MsgsDefs.h"
  23. #include "DeskLib:Msgs.h"
  24.  
  25.  
  26.  
  27. extern void Msgs_DropGroup(char *grouptag)
  28. {
  29.   msgdefptr ptr, next, last;
  30.  
  31.   ptr = msgs_grouplist;            /* Try to find group */
  32.   while (ptr != NULL)
  33.   {
  34.     if (Msgs__MatchToken(grouptag, ptr->tag, TRUE))
  35.       break;
  36.  
  37.     last = ptr;
  38.     ptr = ptr->next;
  39.   }
  40.  
  41.   if (ptr == NULL)                  /* group not found   */
  42.     return;
  43.  
  44.   if (ptr == msgs_grouplist)        /* unlink from list  */
  45.     msgs_grouplist = ptr->next;
  46.   else
  47.     last->next = ptr->next;
  48.  
  49.   next = ptr->data.taglist;         /* Kill group record */
  50.   free(ptr);
  51.   ptr = next;
  52.  
  53.   while (ptr != NULL)               /* Kill message list */
  54.   {
  55.     if (ptr->data.text != NULL)
  56.       free(ptr->data.text);
  57.  
  58.     next = ptr->next;
  59.     free(ptr);
  60.     ptr = next;
  61.   }
  62. /* cc warns 'last' may be used before being set    */
  63. }
  64.